//==========================================================================
// Copyright (c) 2000-2006,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_RTC_H__
#define __ELASTOS_RTC_H__

#include <driver.h>

class CRTC : public CDeviceDriver {
public:
    CARAPI Read(
        /* [in] */ Int64 u64Offset,
        /* [in] */ Int32 bytesToRead,
        /* [out] */ MemoryBuf * pBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Write(
        /* [in] */ Int64 u64Offset,
        /* [in] */ const MemoryBuf & buffer,
        /* [out] */ Int32 * pBytesWritten,
        /* [out] */ IEvent * * ppCompletionEvent);

    CARAPI Control(
        /* [in] */ Handle32 nControlCode,
        /* [in] */ const MemoryBuf &inBuffer,
        /* [out] */ MemoryBuf *pOutBuffer,
        /* [out] */ IEvent * * ppCompletionEvent);

    virtual void Dispose();

public:
    CRTC(){};
    ~CRTC(){};
    void Init();
};
EXTERN_C void RTCInit();
EXTERN_C void RTCDispose();
EXTERN_C ECode RTCEnableAlarm();
EXTERN_C ECode RTCDisableAlarm();
EXTERN_C ECode RTCReadTime(int *hour, int *min, int *second);
EXTERN_C ECode RTCReadDate(int *week, int *year, int *month, int *date);
EXTERN_C ECode RTCReadAlarmTime(int *hour, int *min, int *second);
EXTERN_C ECode RTCReadAlarmDate(int *week, int *year, int *month, int *date);
EXTERN_C ECode RTCSettime(int hour, int min, int second);
EXTERN_C ECode RTCSetdate(int week, int year, int month, int date);
EXTERN_C ECode RTCSetAlarmtime(int hour, int min, int second);
EXTERN_C ECode RTCSetAlarmdate(int week, int year, int month, int date);
EXTERN_C ECode RTCSetdatetime(SystemTime *pSystemTime);
EXTERN_C ECode RTCSetAlarmDateAndTime(int *p);
EXTERN_C ECode RTCReadAlarmDateAndTime(MemoryBuf * pOutData);
EXTERN_C ECode RTCReadDateAndTime(MemoryBuf * pOutData);
#endif // __ELASTOS_RTC_H__
